<template>
  <pageTabelLayout>
    <template #pageHeader>
      <div class="search-form divClass" v-if="headerShow">
        <a-form size="small" :model="pageData.queryData" layout="inline">
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="记录单号">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.notesCode"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="开单时间">
              <a-date-picker  popup-container="html" 
                class="bacClass"
                v-model="pageData.queryData.qrTime"
                style="width: 100%"
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="时间区间">
              <a-date-picker  popup-container="html" 
                class="bacClass"
                v-model="pageData.queryData.qrTime2"
                style="width: 100%"
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="流转卡">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.qrCode"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="布号">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.greyCode"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="品名">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.productName"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="色号">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.colorCode"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="色称">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.colorName"
                allow-clear
              />
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item :label-col-flex="pageData.labelColFlex1" label="客户">
              <a-input
                @press-enter="selectHandler"
                class="bacClass"
                v-model="pageData.queryData.customName"
                allow-clear
              />
            </a-form-item>
          </a-col>
        </a-form>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up
            v-if="headerShow"
            @click="headerShow = false"
            :strokeWidth="2"
            :size="18"
          />
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
        </a-divider>
      </div>
      <div class="my-tool-bar">
        <Toolbar :items="['查询', '新增']" @add="addHandler" @select="selectHandler"> </Toolbar>
      </div>
    </template>
    <template #pageTabel>
      <AgGridVuesCopys
        :rowHeight="33"
        :headerHeight="33"
        rowSelection="multiple"
        @grid-ready="gridReady"
        style="height: 100%"
        :defaultColDef="defaultColDef"
        class="ag-theme-alpine"
        :rowData="table.dataList"
        :columnDefs="tc"
        :localeText="localeText1"
        :suppressRowClickSelection="true"
      ></AgGridVuesCopys>
    </template>

    <paginationCopys
      :page-size="pagination.pageSize"
      :current="pagination.page"
      :total="pagination.total"
      show-total
      show-jumper
      show-page-size
      @change="nextDoRefreshPage"
      @page-size-change="nextDoRefreshSize"
      style="justify-content: center"
    />

    <a-drawer
      placement="bottom"
      :drawer-style="{ zIndex: 9999 }"
      :mask-closable="false"
      height="90%"
      :visible="pageData.showAdd"
      unmountOnClose
      @ok="sideOk"
      @cancel="pageData.showAdd = false"
      cancel-text="关闭"
      ok-text="保存"
    >
      <template #title>
        {{ pageData.sideTitle }}
      </template>
      <div style="width: 100%; height: 100%">
        <a-form ref="formRef" :model="dataForm" layout="horizontal">
          <a-row class="grid-demo" :gutter="24">
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="开单时间"
                :rules="[{ required: true, message: '开单时间为空' }]"
                field="qrTime"
                :validate-trigger="['change', 'blur']"
              >
                <a-date-picker  popup-container="html"  style="width: 100%" class="bacClass" v-model="dataForm.qrTime" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="流转卡号"
                field="qrCode"
                :validate-trigger="['change', 'blur']"
                :rules="[{ required: true, message: '流转卡号为空' }]"
              >
                <a-input-search
                  class="bacClass"
                  placeholder="请输入流转卡扫描"
                  v-model="dataForm.qrCode"
                  button-text="提取"
                  search-button
                  @search="search"
                />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="布号"
                field="greyCode"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.greyCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="品名"
                field="productName"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.productName" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="匹数"
                field="houseNum"
                :validate-trigger="['change', 'blur']"
              >
                <a-input-number class="bacClass" v-model="dataForm.houseNum" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="重量"
                field="orderWeight"
                :validate-trigger="['change', 'blur']"
              >
                <a-input-number class="bacClass" v-model="dataForm.orderWeight" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="色号"
                field="colorCode"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.colorCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="色称"
                field="colorName"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.colorName" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="确认色"
                field="affirmColor"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.affirmColor" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="订单号"
                field="planOrderCode"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.planOrderCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="门幅"
                field="doorWidth"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.doorWidth" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="克重"
                field="gramWeight"
                :validate-trigger="['change', 'blur']"
              >
                <a-input-number class="bacClass" v-model="dataForm.gramWeight" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="合约号"
                field="contractNo"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.contractNo" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="客户订单号"
                field="customerOrderNo"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.customerOrderNo" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="客户名称"
                field="customName"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.customName" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="收货地址"
                field="receiverAddress"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.receiverAddress" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="拼缸卡号"
                field="togetherCode"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.togetherCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="设备编号"
                field="machineCode"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.machineCode" />
              </a-form-item>
            </a-col>
            <a-col :span="6">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="生产车间"
                field="workShop"
                :validate-trigger="['change', 'blur']"
              >
                <a-input class="bacClass" v-model="dataForm.workShop" />
              </a-form-item>
            </a-col>
            <a-col :span="24">
              <a-form-item
                :label-col-flex="pageData.labelColFlex"
                label="备注"
                field="remark"
                :validate-trigger="['change', 'blur']"
              >
                <a-textarea class="bacClass" v-model="dataForm.remark" />
              </a-form-item>
            </a-col>
          </a-row>
          <!-- <a-row class="grid-demo" :gutter="24">
            <a-col :span="16">
              <el-table
                :data="dataForm.cardQrDetailedList"
                style="width: 100%"
                :header-cell-style="{ color: '#696969', background: '#f5f7fa' }"
                tooltip-effect="dark"
                border
              >
                <el-table-column prop="num" label="序号" width="80" align="center">
                </el-table-column>
                <el-table-column prop="qsCode" label="二维码" align="center"> </el-table-column>
                <el-table-column prop="storage" label="成品入库" align="center" width="120">
                  <template #default="scope">
                    <a-checkbox
                      v-model="dataForm.cardQrDetailedList[scope.$index].storage"
                    ></a-checkbox>
                  </template>
                </el-table-column>
                <el-table-column prop="goods" label="成品发货" width="120" align="center">
                  <template #default="scope">
                    <a-checkbox
                      v-model="dataForm.cardQrDetailedList[scope.$index].goods"
                    ></a-checkbox>
                  </template>
                </el-table-column>
                <el-table-column prop="remark" label="备注" align="center">
                  <template #default="scope">
                    <a-input v-model="dataForm.cardQrDetailedList[scope.$index].remark" />
                  </template>
                </el-table-column>
              </el-table>
            </a-col>
            <a-col :span="8"></a-col>
          </a-row> -->
        </a-form>
        <div style="width: 100%; height: 60%">
          <encapsulation-agrid
            ref="configAgGridRef"
            :configaggrid="configaggrid"
          ></encapsulation-agrid>
        </div>
      </div>
    </a-drawer>
  </pageTabelLayout>
</template>

<script lang="ts">
  import { post, get } from '@/api/http'
  import { useTable, usePagination, useTableColumn } from '@/hooks/table'

  import { ref, reactive, onMounted } from 'vue'
  import Toolbar from '@/components/Toolbar.vue'
  import { Message, Modal } from '@arco-design/web-vue'
  import { FormInstance } from '@arco-design/web-vue/es/form'
  import 'ag-grid-community/styles/ag-grid.css'
  import 'ag-grid-community/styles/ag-theme-alpine.css'
  import { localeText } from '@/api/aggridZw'
  

  interface paramData {
    id: any //id
    notesCode: string | undefined //记录单号
    qrTime: string | undefined //开单时间
    qrTime2: string | undefined //时间区间
    qrCode: string | undefined //流转卡
    greyCode: string | undefined //布号
    productName: string | undefined //品名
    houseNum: any //匹数
    orderWeight: any //重量
    colorCode: string | undefined //色号
    colorName: string | undefined //色称
    affirmColor: string | undefined //确认色
    planOrderCode: string | undefined //订单号
    doorWidth: string | undefined //门幅
    gramWeight: any //克重
    contractNo: string | undefined //合约号
    customerOrderNo: string | undefined //客户订单号
    customName: string | undefined //客户
    receiverAddress: string | undefined //收货地址
    togetherCode: string | undefined //拼缸卡号
    machineCode: string | undefined //设备编号
    workShop: string | undefined //生产车间
    remark: string | undefined //备注
    cardQrDetailedList: any
  }

  export default {
    //流转卡二维码登记列表
    name: 'QRCodeRegistration',
    setup() {
      //隐藏显示头部
      const headerShow = ref<boolean>(true)
      const pageData = reactive<{
        showAdd: boolean
        sideTitle: string
        dropDownData: any
        pageLoading: boolean
        theight: number
        rHeight: number | undefined
        labelColFlex: string
        createTimeArr: any
        queryData: any
        labelColFlex1: string
        departmentTree: any
      }>({
        showAdd: false,
        sideTitle: '新增流转卡二维码登记',
        dropDownData: '',
        pageLoading: false,
        theight: 0,
        rHeight: 0,
        labelColFlex: '120px',
        createTimeArr: [],
        queryData: {
          qrTime: '', //开单时间
          qrTime2: '', //时间区间
          notesCode: '', //记录单号
          qrCode: '', //流转卡
          greyCode: '', //布号
          productName: '', //品名
          colorCode: '', //色号
          colorName: '', //色称
          customName: '', //客户
        },
        labelColFlex1: '100px',
        departmentTree: [],
      })
      const dataForm = reactive<paramData>({
        id: null, //id
        notesCode: '', //记录单号
        qrTime: '', //开单时间
        qrTime2: '', //时间区间
        qrCode: '', //流转卡
        greyCode: '', //布号
        productName: '', //品名
        houseNum: 0, //匹数
        orderWeight: 0, //重量
        colorCode: '', //色号
        colorName: '', //色称
        affirmColor: '', //确认色
        planOrderCode: '', //订单号
        doorWidth: '', //门幅
        gramWeight: 0, //克重
        contractNo: '', //合约号
        customerOrderNo: '', //客户订单号
        customName: '', //客户
        receiverAddress: '', //收货地址
        togetherCode: '', //拼缸卡号
        machineCode: '', //设备编号
        workShop: '', //生产车间
        remark: '', //备注
        cardQrDetailedList: [],
      })
      //查询列表
      onMounted(() => {
        selectHandler()
      })

      //切换分页
      const nextDoRefreshPage = (val: any) => {
        pagination.page = val
        doRefresh()
      }
      const nextDoRefreshSize = (val: any) => {
        pagination.pageSize = val
        doRefresh()
      }
      const pagination = usePagination(doRefresh)
      const table = useTable()
      function doRefresh() {
        pageData.pageLoading = true
        pageData.queryData.page = pagination.page
        pageData.queryData.limit = pagination.pageSize
        post({
          url: 'aps/circulatCardQr/findCirculatCardQr',
          data: pageData.queryData,
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              table.handleSuccess(data.list)
              pagination.setTotalSize(data.total)
              gridOption.value.setRowData(data.list)
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
          })
      }
      //查询
      const selectHandler = () => {
        pagination.page = 1
        doRefresh()
      }
      //------新增、修改页面开始------
      const addHandler = () => {
        for (var key in dataForm) {
          if (key === 'id') {
            dataForm[key] = null
          } else if (key === 'cardQrDetailedList') {
            dataForm[key] = []
          } else {
            dataForm[key] = ''
          }
          dataForm['qrTime'] = new Date()
        }
        pageData.showAdd = true
        pageData.sideTitle = '新增流转卡二维码登记'
      }
      const editHandler = (record: paramData) => {
        post({
          url: 'aps/circulatCardQr/findCirculatCardQrId',
          data: {
            id: record.id,
          },
        }).then(({ data, code }: any) => {
          if (code === 200) {
            for (var key in data) {
              dataForm[key] = data[key]
            }
          }
        })
        pageData.sideTitle = '修改流转卡二维码登记'
        pageData.showAdd = true
      }

      const formRef = ref<FormInstance>()
      const sideOk = () => {
        formRef.value?.validate().then((err) => {
          if (!err) {
            if (pageData.sideTitle === '新增流转卡二维码登记') {
              post({
                url: 'aps/circulatCardQr/saveCirculatCardQr',
                data: dataForm,
              }).then((res: any) => {
                if (res.code === 200) {
                  formRef.value?.resetFields()

                  pageData.showAdd = false

                  Message.success({
                    content: '新增成功',
                    duration: 5000,
                  })
                  selectHandler()
                } else {
                  Message.error({
                    content: res.message,
                    duration: 5000,
                  })
                }
              })
            } else {
              post({
                url: 'aps/circulatCardQr/updateCirculatCardQr',
                data: dataForm,
              }).then((res: any) => {
                if (res.code === 200) {
                  formRef.value?.resetFields()
                  pageData.showAdd = false

                  Message.success({
                    content: '修改成功',
                    duration: 5000,
                  })
                  selectHandler()
                } else {
                  Message.error({
                    content: res.message,
                    duration: 5000,
                  })
                }
              })
            }
          }
        })
      }
      //------新增、修改页面结束------
      //------删除方法开始------
      const deleteHandler = () => {
        if (gridOption.value.getSelectedRows().length === 0) {
          return
        }
        Modal.confirm({
          title: '系统提示',
          content: '确认删除选中的数据?',
          onOk() {
            post({
              url: 'dwQms/BatchcolorFormula/delete',
              data: gridOption.value.getSelectedRows().map((o: any) => {
                return o.id
              }),
            }).then(({ code, data }: any) => {
              if (code === 200) {
                Message.success({
                  content: '删除成功',
                  duration: 5000,
                })

                pagination.page = 1
                selectHandler()
              } else {
                Message.error({
                  content: '删除失败',
                  duration: 5000,
                })
              }
            })
          },
        })
      }
      //------删除方法结束------

      // 表格准备事件
      const tableColumns = useTableColumn([
        {
          title: '序号',
          key: 'id',
          dataIndex: 'id',
          width: 150,
        },
        {
          title: '记录单号',
          key: 'notesCode',
          dataIndex: 'notesCode',
        },
        {
          title: '开单日期',
          key: 'qrTime',
          dataIndex: 'qrTime',
        },
        {
          title: '生产车间',
          key: 'workShop',
          dataIndex: 'workShop',
        },
        {
          title: '流转卡号',
          key: 'qrCode',
          dataIndex: 'qrCode',
        },
        {
          title: '布号',
          key: 'greyCode',
          dataIndex: 'greyCode',
        },
        {
          title: '品名',
          key: 'productName',
          dataIndex: 'productName',
        },
        {
          title: '色号',
          key: 'colorCode',
          dataIndex: 'colorCode',
        },
        {
          title: '匹数',
          key: 'houseNum',
          dataIndex: 'houseNum',
        },
        {
          title: '色称',
          key: 'colorName',
          dataIndex: 'colorName',
        },
        {
          title: '重量',
          key: 'orderWeight',
          dataIndex: 'orderWeight',
        },
        {
          title: '门幅',
          key: 'doorWidth',
          dataIndex: 'doorWidth',
        },
        {
          title: '克重',
          key: 'gramWeight',
          dataIndex: 'gramWeight',
        },
        {
          title: '客户名称',
          key: 'customName',
          dataIndex: 'customName',
        },
        {
          title: '合约号',
          key: 'contractNo',
          dataIndex: 'contractNo',
        },
        {
          title: '客户订单号',
          key: 'customerOrderNo',
          dataIndex: 'customerOrderNo',
        },
        {
          title: '设备编号',
          key: 'machineCode',
          dataIndex: 'machineCode',
        },
        {
          title: '收货地址',
          key: 'receiverAddress',
          dataIndex: 'receiverAddress',
        },
        {
          title: '拼缸卡号',
          key: 'togetherCode',
          dataIndex: 'togetherCode',
        },
        {
          title: '创建人',
          key: 'createName',
          dataIndex: 'createName',
        },
        {
          title: '创建时间',
          key: 'createTime',
          dataIndex: 'createTime',
        },
        {
          title: '操作',
          key: 'id',
          dataIndex: 'id',
          slotName: 'act',
          width: 150,
          fixed: 'right',
        },
      ])
      const gridOption = ref()
      const gridReady = (params: any) => {
        gridOption.value = params.api
      }
      const defaultColDef = {
        sortable: true,
        resizable: true,
        filter: true,
        // flex: 1
      }
      let tc: any[] = tableColumns.map((o) => {
        let obj = {
          headerName: o.title,
          field: o.key,
          pinned: o['fixed'],
          width: o.width,
          children: o.children,
          cellRenderer: o.cellRenderer,
        }
        if (o.slotName === 'act') {
          obj['resizable'] = false
          obj['filter'] = false
          obj['sortable'] = false
          obj['lockPosition'] = o.fixed
          obj['cellRenderer'] = {
            template: `<el-button style="color:#165dff;" link @click="a">修改</el-button>`,
            setup(props: any) {
              const a = () => {
                editHandler(props.params.data)
              }
              return {
                a,
              }
            },
          }
        }
        return obj
      })
      let a = [
        {
          showRowGroup: 'hide_def',
          headerName: '',
          checkboxSelection: true,
          headerCheckboxSelection: true,
          pinned: 'left',
          width: 50,
          resizable: false,
          filter: false,
          sortable: false,
          minWidth: 50,
          maxWidth: 50,
          lockPosition: 'left',
        },
      ]
      tc = a.concat(tc)
      const localeText1: any = ref(localeText)

      // 获取部门列表
      const getBmGroup = () => {
        post({
          url: 'org/baCompany/getDepartmentTree?companyId=' + 12,
        }).then((result) => {
          if (result.code === 200) {
            pageData.departmentTree = result.data
          }
        })
      }

      //流转卡号提取
      const search = (val: any) => {
        get({
          url: 'aps/circulatCard/findFlowCardCodePlanorder',
          data: { flowCardCode: dataForm.qrCode },
        }).then((res: any) => {
          if (res.code === 200) {
            if (res.data.length == 0) {
              Message.error({
                content: '流转卡号不存在！',
                duration: 5000,
              })
            } else {
              var obj = res.data
              //赋值
              dataForm.greyCode = obj.greyCode
              dataForm.productName = obj.productName
              dataForm.houseNum = obj.houseNum
              dataForm.orderWeight = obj.flowCardWeight
              dataForm.colorCode = obj.colorCode
              dataForm.colorName = obj.colorName
              dataForm.affirmColor = obj.affirmColor
              dataForm.planOrderCode = obj.orderCode
              dataForm.doorWidth = obj.efficacious
              dataForm.gramWeight = obj.gramWeight
              dataForm.contractNo = obj.contractNo
              dataForm.customerOrderNo = obj.clientPlanOrderCode
              dataForm.customName = obj.customName
              dataForm.receiverAddress = obj.receiverAddress
              dataForm.togetherCode = obj.togetherCode

              dataForm.cardQrDetailedList = []
              for (let index = 0; index < dataForm.houseNum; index++) {
                var num: number = index + 1
                var o: any = {
                  num: num,
                  qsCode: dataForm.qrCode + '-' + num,
                  storage: '',
                  goods: '',
                  remark: '',
                }
                dataForm.cardQrDetailedList.push(o)
              }
            }
          } else {
            Message.error({
              content: res.message,
              duration: 5000,
            })
          }
        })
      }
      const configAgGridRef = ref(null)
      const addDrawerColumn = ref([
        {
          showRowGroup: 'hide_def',
          headerName: '',
          checkboxSelection: true,
          headerCheckboxSelection: true,
          pinned: 'left',
          width: 50,
          resizable: false,
          filter: false,
          sortable: false,
          minWidth: 50,
          maxWidth: 50,
          lockPosition: 'left',
        },
        {
          headerName: '二维码',
          field: 'qsCode',
        },
        {
          headerName: '成品入库',
          field: 'storage',
        },
        {
          headerName: '成品发货',
          field: 'goods',
        },
        {
          headerName: '备注',
          field: 'remark',
        },
      ])
      let configaggrid = ref({
        url: '', //接口路径
        queryData: {
          //接口参数
        },
        paginationShow: true, //分页是否显示
        invokeiIterface: false, //是否调用接
        rowMultiSelectWithClick: true, //点击行是否多选
        column: addDrawerColumn,
      })
      return {
        deleteHandler,
        sideOk,
        formRef,
        dataForm,
        addHandler,
        pagination,
        table,
        pageData,
        editHandler,
        selectHandler,
        headerShow,
        nextDoRefreshPage,
        nextDoRefreshSize,
        defaultColDef,
        localeText1,
        tc,
        gridReady,
        gridOption,
        getBmGroup,
        search,
        configAgGridRef,
        addDrawerColumn,
        configaggrid,
      }
    },
    components: { Toolbar,  },
  }
</script>
<style scoped lang="less">
  :deep(.ag-cell) {
    border-right: 1px solid #dde2eb;
  }

  :deep(.ag-header-cell) {
    border-right: 1px solid #dde2eb;
  }

  :deep(.ag-cell-value) {
    user-select: initial;
    -moz-user-select: text;
    -ms-user-select: text;
    -webkit-user-select: text;
  }
</style>
